package com.itheima.sh.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.Duration;

/**
 * @Description:
 * @Version: V1.0
 */
@ConfigurationProperties(prefix = "heima.redis")
public class RedisProperties {

    /**
     * 数据库默认：0
     */
    private int database = 0;


    /**
     * Redis主机默认：localhost
     */
    private String host = "localhost";

    /**
     * Redis登录密码默认为空
     */
    private String password;

    /**
     * Redis端口默认：6379
     */
    private int port = 6379;

    /**
     * 连接超时时间: 默认2s
     */
    private Duration timeout = Duration.ofSeconds(2);

    public int getDatabase() {
        return database;
    }

    public void setDatabase(int database) {
        this.database = database;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public Duration getTimeout() {
        return timeout;
    }

    public void setTimeout(Duration timeout) {
        this.timeout = timeout;
    }
}
